<%-- 
    Document   : index
    Created on : 24-mag-2011, 15.45.46
    Author     : dav
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <link href="style.css" rel="stylesheet" type="text/css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Biblioteca</title>
    </head>
    <body><%
    if(session.getAttribute("username")==null){
        %>                     
        <script type="text/javascript">

                         alert("Non autorizzato");

                         window.location.href="index.jsp";

                     </script>
    <%
    }
    
    %>
        <div id="container">
        <div id="header">Biblioteca Online</div>

            <div id="menu">
                <jsp:include page="menu.jsp" flush="true"/>                        
            </div>
            
            <div id="content">
                <center><h1>Prenotazione libro</h1></center>
                
                <form action="cPrenotazioni?action=p" method="POST">
                     <center> 
                    <table id="tabprenotazioni">
                        <tr>
                            <td>
                                Titolo : 
                            </td>
                            <td>
                                <%if(request.getParameter("titololibro")!=null){ 
                            out.print(request.getParameter("titololibro"));
                        }else if(request.getAttribute("titolo")!=null){
                            out.print(request.getAttribute("titolo"));
                        }%></td>
                        </tr>
                        <tr>
                            <td>
                                Autore : 
                            </td>
                            <td>
                                <%if(request.getParameter("autorelibro")!=null){ 
                            out.print(request.getParameter("autorelibro"));
                        }else if(request.getAttribute("autore")!=null){
                            out.print(request.getAttribute("autore"));
                        }%></td>
                        </tr>
                        <tr>
                            <td>
                                Editore : 
                            </td>
                            <td>
                                <%if(request.getParameter("editorelibro")!=null){ 
                            out.println(request.getParameter("editorelibro"));
                        }else if(request.getAttribute("editore")!=null){
                            out.print(request.getAttribute("editore"));
                        }%></td>
                        </tr>
                        <tr>    
                            <td>
                                Anno : 
                            </td>
                            <td>
                                <%if(request.getParameter("annolibro")!=null){ 
                            out.print(request.getParameter("annolibro"));
                        }else if(request.getAttribute("anno")!=null){
                            out.print(request.getAttribute("anno"));
                        }%></td>
                        </tr>
                        <tr style="height:10px"></tr>
                        <tr>
                            <td colspan="2"><center>
                                <input type="hidden" name="titolo" value="<%=request.getParameter("titololibro")%>"/>
                                <input type="hidden" name="autore" value="<%=request.getParameter("autorelibro")%>"/>
                                <input type="hidden" name="editore" value="<%=request.getParameter("editorelibro")%>"/>
                                <input type="hidden" name="anno" value="<%=request.getParameter("annolibro")%>"/>
                                <input type="submit" value="Prenota"<% if(request.getAttribute("LibroPrenotato")!=null){ %>DISABLED<%}%> ></form>
                        <form action="<% if(request.getAttribute("LibroPrenotato")!=null){%>javascript:history.go(-2)<%}else{%>
                            javascript:history.back();<%}%>" method="POST"><input type="submit" value="Annulla"/></form>
                                </center>
                            </td>
                        </tr>
                        
                    </table>
                        <% if(request.getAttribute("LibroPrenotato")!=null){%>
                        <div style="color:red">Libro gi&agrave prenotato</div>
                        <% } %>  
                    </center>
                        
            </div>    
        </div>
        
    </body>
</html>
